﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zor_DAL;
using Zor_Modes;

namespace Zor_Bll
{
    public class PropertyInfo_Bll
    {
        /// <summary>
        /// 房产信息添加
        /// </summary>
        /// <param name="pi"></param>
        /// <returns></returns>
        public static BaseAnswer InserPropertyInfo(PropertyInfo pi) 
        {
            BaseAnswer bar = PropertyInfo_DAL.InserPropertyInfo(pi);
            if (bar.AnswerType == BaseAnswer.Answers.Succee)
                bar.AnswerMeg = "新增成功！";
            else if (bar.AnswerType == BaseAnswer.Answers.Failure)
                bar.AnswerMeg = "新增失败，请重试！";
            return bar;
        }

         /// <summary>
        /// 获取房产信息
        /// </summary>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        public static List<PropertyInfo> GetPropertyInfoList(string sqlWhere)
        {
            return PropertyInfo_DAL.GetPropertyInfoList(sqlWhere);
        }

        /// <summary>
        /// 获取街办信息
        /// </summary>
        /// <returns>返回Dt_ParentId街办ID，Dt_ParentName街办名称</returns>
        public static List<PropertyInfo> GetStreetOffice()
        {
            return PropertyInfo_DAL.GetStreetOffice();
        }

        /// <summary>
        /// 根据街办ID获取社区信息
        /// </summary>
        /// <param name="parentId">街办ID</param>
        /// <returns>返回Dt_Id社区ID,Dt_Name社区名称</returns>
        public static List<PropertyInfo> GetCommunityByStreetOfficeID(int parentId)
        {
            return PropertyInfo_DAL.GetCommunityByStreetOfficeID(parentId);
        }

        /// <summary>
        /// 根据社区ID获取楼宇信息
        /// </summary>
        /// <param name="communityID">社区ID</param>
        /// <returns>返回Bd_Id楼宇ID,Bd_Name楼宇名称</returns>
        public static List<PropertyInfo> GetBuildingByCommunityID(int communityID)
        {
            return PropertyInfo_DAL.GetBuildingByCommunityID(communityID);
        }


        /// <summary>
        /// 根据楼宇ID获取单元信息
        /// </summary>
        /// <param name="buildingID">楼宇ID</param>
        /// <returns>返回Uim_Id单元ID,Uim_Name单元名称</returns>
        public static List<PropertyInfo> GetUnitInforByBuildingID(int buildingID)
        {
            return PropertyInfo_DAL.GetUnitInforByBuildingID(buildingID);
        }

         /// <summary>
        /// 根据单元ID获取房屋信息
        /// </summary>
        /// <param name="unitInforID">单元ID</param>
        /// <returns>返回Hs_ID房屋ID,Hs_Number房屋名称</returns>
        public static List<PropertyInfo> GetHouseByUnitInforID(int unitInforID)
        {
            return PropertyInfo_DAL.GetHouseByUnitInforID(unitInforID);
        }


        /// <summary>
        /// 获取推送消息集合，根据用户角色权限
        /// </summary>
        /// <returns></returns>
        public static List<PropertyInfo> GetPushMegList(PropertyInfo pi)
        {
            return PropertyInfo_DAL.GetPushMegList(pi);
        }

        /// <summary>
        /// 获取推送消息集合，根据用户角色权限
        /// </summary>
        /// <returns></returns>
        public static List<PropertyInfo> GetPushMegListByUserId(PropertyInfo pi)
        {
            return PropertyInfo_DAL.GetPushMegListByUserId(pi);
        }

        /// <summary>
        /// 删除推送消息
        /// </summary>
        /// <param name="ids">消息id</param>
        /// <returns></returns>
        public static BaseAnswer DelPushMeg(int[] ids)
        {
            BaseAnswer bar = PropertyInfo_DAL.DelPushMeg(ids);
            if (bar.AnswerType == BaseAnswer.Answers.Succee)
                bar.AnswerMeg = "删除成功！";
            else if (bar.AnswerType == BaseAnswer.Answers.Failure)
                bar.AnswerMeg = "删除失败，请重试！";
            return bar;

        }

        /// <summary>
        /// 审批
        /// </summary>
        /// <param name="pi"></param>
        /// <returns></returns>
        public static BaseAnswer ApplyPushMeg(PropertyInfo pi)
        {
            BaseAnswer bar = PropertyInfo_DAL.ApplyPushMeg(pi);
            if (bar.AnswerType == BaseAnswer.Answers.Succee)
                bar.AnswerMeg = "审批成功！";
            else if (bar.AnswerType == BaseAnswer.Answers.Failure)
                bar.AnswerMeg = "审批失败，请重试！";
            return bar;
        }


        /// <summary>
        /// 获取房屋信息
        /// </summary>
        /// <param name="ri"></param>
        /// <returns></returns>
        public static List<PropertyInfo> GetPropertyInfoListByHsId(PropertyInfo pi)
        {
            return PropertyInfo_DAL.GetPropertyInfoListByHsId(pi);
        }

        /// <summary>
        /// 获取房屋信息
        /// </summary>
        /// <param name="ri"></param>
        /// <returns></returns>
        public static List<PropertyInfo> GetPropertyInfoListByDtParentId(PropertyInfo pi)
        {
            return PropertyInfo_DAL.GetPropertyInfoListByDtParentId(pi);
        }
    }
}
